from abc import ABC, abstractmethod

from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from app.dependencies.depend_db import get_db_session


class BaseRouter(ABC):
    abstract = True 
    
    def __init__(self) -> None:
        self._router: APIRouter = None  
        
        self.set_router()
        self._router.dependencies.append(Depends(get_db_session))

    @property
    def router(self):
        return self._router

    @router.setter
    def router(self, new_router):
        self._router = new_router

    @abstractmethod
    def set_router(self):
        pass
